package com.kai.admin.feign;

import com.kai.admin.api.TokenApi;
import com.kai.admin.data.SourceUser;
import com.kai.admin.security.service.SecurityTokenService;
import com.kai.common.data.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * <p>
 * token Api实现
 * </p>
 *
 * @author weijk
 * @since 2023/7/17
 */
@Component
public class TokenApiImpl implements TokenApi {

    @Autowired
    private SecurityTokenService securityTokenService;

    /**
     * 校验token
     *
     * @param accessToken token
     * @return 用户信息
     */
    @Override
    public Result<SourceUser> checkToken(String accessToken) {
        return Result.success(securityTokenService.checkToken(accessToken));
    }
}
